package com.pure.common.lambda.reduce;

import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;
import java.util.List;

@Slf4j
public class LambdaReduce {

    public static void main(String[] args) {

        BigDecimal a = new BigDecimal("12.23000");
        BigDecimal b = new BigDecimal("12.32000");
        BigDecimal c = new BigDecimal("12.34000");
        BigDecimal d = new BigDecimal("12.98000");
        List<BigDecimal> bigDecimals = Lists.newArrayList(a, b, c, d);

        BigDecimal reduce = bigDecimals.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
        log.info("reduce = {}", reduce);


    }
}
